var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (i, e) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, i) {
              t.__proto__ = i;
            }) ||
          function (t, i) {
            for (var e in i)
              Object.prototype.hasOwnProperty.call(i, e) && (t[e] = i[e]);
          })(i, e);
      };
      return function (i, e) {
        function n() {
          this.constructor = i;
        }
        if ("function" != typeof e && null !== e)
          throw new TypeError(
            "Class extends value " + String(e) + " is not a constructor or null"
          );
        t(i, e),
          (i.prototype =
            null === e
              ? Object.create(e)
              : ((n.prototype = e.prototype), new n()));
      };
    })(),
  ZhanLiPinView = (function (t) {
    function i() {
      var i = t.call(this) || this;
      return (
        i.btn_zlp_close.on(Laya.Event.CLICK, i, i.onZLPCloseAction),
        i.btn_zlp_coin_100.on(Laya.Event.CLICK, i, i.onSelectCoinAction),
        i.btn_zlp_coin_1000.on(Laya.Event.CLICK, i, i.onSelectCoinAction),
        i.btn_zlp_coin_10000.on(Laya.Event.CLICK, i, i.onSelectCoinAction),
        i.btn_zlp_coin_100000.on(Laya.Event.CLICK, i, i.onSelectCoinAction),
        i.btn_zlp_yinzi.on(Laya.Event.CLICK, i, i.onSureZengJiaCoinAction),
        i.btn_zlp_jinzi.on(Laya.Event.CLICK, i, i.onSureZengJiaCoinAction),
        WebSocketService.addListener({
          caller: i,
          code: 5295,
          method: i.onLoadEnterCoinData,
        }),
        i
      );
    }
    return (
      __extends(i, t),
      (i.openItemView = function (t, e) {
        null == this.itemView &&
          ((this.itemView = new i()),
          (this.itemView.zOrder = 1e3),
          (this.itemView.x = 50),
          (this.itemView.y = 200),
          Laya.stage.addChild(this.itemView)),
          (this.itemView.sumCoin = 0),
          (this.itemView.visible = !0),
          this.itemView.initData(),
          (this.itemView.callback = e);
      }),
      (i.prototype.initData = function () {
        (this.text_zlp_input.text = ""), (this.typeCoin = "yinzi");
      }),
      (i.prototype.onSelectCoinAction = function (t) {
        "item0" == t.target.name
          ? (this.sumCoin += 100)
          : "item1" == t.target.name
          ? (this.sumCoin += 1e3)
          : "item2" == t.target.name
          ? (this.sumCoin += 1e4)
          : "item3" == t.target.name && (this.sumCoin += 1e5),
          (this.text_zlp_input.text = this.sumCoin + "");
      }),
      (i.prototype.onSureZengJiaCoinAction = function (t) {
        var i = t.target.name,
          e = parseInt(this.text_zlp_input.text);
        if (e <= 0) ToastView.toastView("请输入金额");
        else if (((this.typeCoin = i), "yinzi" == i)) {
          if (!(e <= 1e6 && e > 1e5))
            return void ToastView.toastView(
              "战利品为银子，金额需在10-100万之间"
            );
          n = {
            data: { type: 2, range: e },
            title: this.text_zlp_input.text + "银",
          };
          this.callback(n), this.onZLPCloseAction();
        } else if ("jinzi" == i) {
          if (!(e >= 1e3 && e <= 1e4))
            return void ToastView.toastView(
              "战利品为金子，金额需在1000-1万之间"
            );
          var n = {
            data: { type: 1, range: e },
            title: this.text_zlp_input.text + "金",
          };
          this.callback(n), this.onZLPCloseAction();
        }
      }),
      (i.prototype.onLoadEnterCoinData = function (t) {
        ToastView.toastView(t.msg);
        var i = "";
        (i =
          "yinzi" == this.typeCoin
            ? this.text_zlp_input.text + "银"
            : this.text_zlp_input.text + "金"),
          0 == t.code && this.callback(i),
          this.onZLPCloseAction();
      }),
      (i.prototype.onZLPCloseAction = function () {
        this.visible = !1;
      }),
      i
    );
  })(ui.battlefield.ZhanLiPinViewUI);
